package com.bh.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.order.domain.JcOrderBackImages;
import com.bh.order.mapper.JcOrderBackImagesMapper;
import com.bh.order.service.IJcOrderBackImagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 运单回单图片Service业务层处理
 *
 * @author slx
 * @date 2023-04-22
 */
@Service
public class JcOrderBackImagesServiceImpl extends ServiceImpl<JcOrderBackImagesMapper, JcOrderBackImages> implements IJcOrderBackImagesService {
    @Autowired
    private JcOrderBackImagesMapper jcOrderBackImagesMapper;

    /**
     * 查询运单回单图片
     *
     * @param id 运单回单图片主键
     * @return 运单回单图片
     */
    @Override
    public JcOrderBackImages selectJcOrderBackImagesById(Long id) {
        return jcOrderBackImagesMapper.selectById(id);
    }

    /**
     * 查询运单回单图片列表
     *
     * @param jcOrderBackImages 运单回单图片
     * @return 运单回单图片
     */
    @Override
    public List<JcOrderBackImages> selectJcOrderBackImagesList(JcOrderBackImages jcOrderBackImages) {
        return jcOrderBackImagesMapper.selectJcOrderBackImagesList(jcOrderBackImages);
    }

    @Override
    public List<JcOrderBackImages> selectJcOrderBackImagesListByBackId(Long jcOrderBackId) {
        return jcOrderBackImagesMapper.selectJcOrderBackImagesListByBackId(jcOrderBackId);
    }

    /**
     * 新增运单回单图片
     *
     * @param jcOrderBackImages 运单回单图片
     * @return 结果
     */
    @Override
    public int insertJcOrderBackImages(JcOrderBackImages jcOrderBackImages) {
        jcOrderBackImages.setCreateTime(DateUtils.getNowDate());
        return jcOrderBackImagesMapper.insert(jcOrderBackImages);
    }

    /**
     * 修改运单回单图片
     *
     * @param jcOrderBackImages 运单回单图片
     * @return 结果
     */
    @Override
    public int updateJcOrderBackImages(JcOrderBackImages jcOrderBackImages) {
        return jcOrderBackImagesMapper.updateById(jcOrderBackImages);
    }

    /**
     * 批量删除运单回单图片
     *
     * @param ids 需要删除的运单回单图片主键
     * @return 结果
     */
    @Override
    public int deleteJcOrderBackImagesByIds(Long[] ids) {
        return jcOrderBackImagesMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除运单回单图片信息
     *
     * @param id 运单回单图片主键
     * @return 结果
     */
    @Override
    public int deleteJcOrderBackImagesById(Long id) {
        return jcOrderBackImagesMapper.deleteById(id);
    }
}
